package itzzj.test.Iochar;


import java.nio.charset.StandardCharsets;

/**
 * 编码解码
 */
public class EnDeCode {
    public static void main(String[] args) {
        String var = "IO流";
        // 编码
        byte[] enVar = var.getBytes(StandardCharsets.UTF_8);
        for (byte encode : enVar) {
            System.out.println(encode);
        }
        // 解码
        String deVar = new String(enVar, StandardCharsets.UTF_8);
        System.out.println(deVar);
        // 乱码
        String messyVar = new String(enVar, StandardCharsets.ISO_8859_1);
        System.out.println(messyVar);
    }
}































